﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using AccessBasedDesktop.Core;

namespace AccessBasedDesktop.Service
{
    public partial class AccessBasedDesktopService : ServiceBase
    {
        public AccessBasedDesktopService()
        {
            InitializeComponent();
        }

        private Manager manager;

        protected override void OnStart(string[] args)
        {
            if (manager == null)
            {
                manager = new Manager(Options.LoadFromFile());
            }
        }

        protected override void OnStop()
        {
            if (manager != null)
            {
                manager.Dispose();
                manager = null;
            }
        }
    }
}
